package com.xiao.mapper;

import com.xiao.entity.EmployeeEntity;
import org.apache.ibatis.annotations.*;

/**
 * @_PackageName:com.xiao.mapper
 * @_ClassName:EmployeeMapper
 * @_Description:
 * @_Author：笑老二
 * @_data 2020/12/12 20:49
 */

//指定这是一个操作数据的mapper
//@Mapper
public interface EmployeeMapper {

    @Select("select * from employee where eid = #{eid}")
    public EmployeeEntity findOneByEid(int eid);

    @Delete("delete from employee where eid = #{eid}")
    public int delOneByEid(int eid);

    /**
     * useGeneratedKeys ：是否获取自增主键
     * keyProperty = "eid" ：封装的自增主键名
     */
    @Options(useGeneratedKeys = true, keyProperty = "eid")
    @Insert("insert into employee values(null,#{ename},#{epsw})")
    public int insert(EmployeeEntity employeeEntity);

    @Update("update employee set ename = #{ename},epsw = #{espw} where eid = #{eid}")
    public int update(EmployeeEntity employeeEntity);

}
